package cn.wolfcode.trip.app.controller;

import cn.wolfcode.trip.base.domain.*;
import cn.wolfcode.trip.base.query.NewsPageQueryObject;
import cn.wolfcode.trip.base.query.StrategyCommentQueryObject;
import cn.wolfcode.trip.base.query.StrategyQueryObject;
import cn.wolfcode.trip.base.service.*;
import cn.wolfcode.trip.base.util.JSONResult;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 日报资源控制器
 */
@RestController
@RequestMapping("newsPages")
public class NewsPageController {
    @Autowired
    private INewsPageService newsPageService;

    /**
     * App分页
     * @param qo
     * @return
     */
    @GetMapping
    public PageInfo list(NewsPageQueryObject qo){
        qo.setPageSize(8);

       return newsPageService.queryApp(qo);
    }

    /**
     * 获取某一日报的日报内容
     * @param newsId
     * @return
     */
    @GetMapping("/{newsId}/comtents")
    public NewsPage selectNewsContentById(@PathVariable Long newsId){
       return newsPageService.selectNewsContentById(newsId);

    }
    /**
     * 保存浏览量
     * @param nums
     * @return
     */
    @PostMapping("/number")
    public int save(NumBrowse nums){
        return newsPageService.save(nums);
    }
    /**
     * 获取获取浏览量
     * @param id
     * @return
     */
    @GetMapping("/scanNumber")
    public int selectScanNumber(Long id){
        return newsPageService.selectScanNumber(id);

    }


}
